package com.bt.lms.ui.page.teaching.plan;

import com.bt.lms.ui.action.teaching.plan.LTeachingPlanViewDetailsReturnTeachingPlanBtnAction;
import com.bt.lms.main.BotLmsApp;
import com.bt.lms.ui.page.sys.style.BtnStyle;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;

/**
 * 教学管理
 * 查看教学计划详情
 */
public class PageViewDetailsTeachingPlan extends VBox {




    public PageViewDetailsTeachingPlan(){


        //初始化所在位置
        initLocation();

        //教学计划的基本信息
        initBasic();

        //初始化返回按钮
        initReturnButton();

        this.setPrefWidth(BotLmsApp.PER_WIGHT);

    }

    /**
     * 初始化所在位置
     */
    public void initLocation(){

        HBox hBox = new HBox();
        Insets insets = new Insets(10);
        hBox.setPadding(insets);
        Label label = new Label("当前位置：🏠>教学管理>教学计划>查看教学计划详情");
        Font font = Font.font("仿宋", FontWeight.THIN, FontPosture.REGULAR,18);
        label.setFont(font);
        hBox.getChildren().add(label);
        this.getChildren().add(hBox);

    }

    /**
     * 教学计划的基本信息
     */
    public void initBasic(){

        //上半部分主盒子
        VBox vBox = new VBox();
        Insets insets = new Insets(10);
        vBox.setPadding(insets);
        vBox.setPrefHeight(350);
        this.getChildren().add(vBox);
        //盒子中的上半部分盒子
        VBox upVBox = new VBox();
        upVBox.setPrefHeight(vBox.getPrefHeight()*0.3);
        upVBox.setAlignment(Pos.CENTER);
        Label nameLab = new Label("2023年java高级工程师教学计划");
        Font font = Font.font("宋体", FontWeight.BLACK, 17);
        nameLab.setFont(font);
        upVBox.getChildren().add(nameLab);
        //下半部分盒子
        HBox belowHBox = new HBox();
        belowHBox.setPrefWidth(1060);
        belowHBox.setPrefHeight(vBox.getPrefHeight()-upVBox.getPrefHeight());
        belowHBox.setPadding(insets);


        //左边的盒子
        VBox leftVBox = new VBox();
        leftVBox.setPrefWidth(340);
        //中间的盒子
        VBox centreVBox = new VBox();
        centreVBox.setMinWidth(belowHBox.getPrefWidth()*0.5);
        centreVBox.setPadding(insets);

        //所属院校
        Label belongToCollegeLabel = new Label("所属的学习中心:");
        Label belongToCollegeValueLab = new Label("清华大学");
        Label applyLevelLabel = new Label("适合层次:");
        Label applyLevelValueLab = new Label("免费师范生");
        //所属专业
        Label belongToMajorLabel = new Label("所属专业:");
        Label belongToMajorValueLab = new Label("Java高级工程师");
        Label lengthOfSchoolingLabel = new Label("学制:");
        Label lengthOfSchoolingValueLab = new Label("1年");

        //可重修次数
        Label numberOfRepairableTimesLabel = new Label("可重修次数:");
        Label numberOfRepairableTimesValueLab = new Label("1~3年");
        Label semesterLab = new Label("当前学期:");
        Label semesterValueLab = new Label("第一学期");

        //试听时间
        Label auditionTimeLabel = new Label("试听时间:");
        Label auditionTimeValueLabel = new Label("1个月");


        //网格
        GridPane gridPane = new GridPane();
        gridPane.setHgap(100);
        gridPane.setHgap(50);

        gridPane.add(belongToCollegeLabel,0,0);
        gridPane.add(belongToCollegeValueLab,1,0);
        gridPane.add(applyLevelLabel,2,0);
        gridPane.add(applyLevelValueLab,3,0);

        gridPane.add(belongToMajorLabel,0,1);
        gridPane.add(belongToMajorValueLab,1,1);
        gridPane.add(lengthOfSchoolingLabel,2,1);
        gridPane.add(lengthOfSchoolingValueLab,3,1);

        gridPane.add(numberOfRepairableTimesLabel,0,2);
        gridPane.add(numberOfRepairableTimesValueLab,1,2);
        gridPane.add(semesterLab,2,2);
        gridPane.add(semesterValueLab,3,2);

        gridPane.add(auditionTimeLabel,0,3);
        gridPane.add(auditionTimeValueLabel,1,3);


        centreVBox.getChildren().add(gridPane);


        belowHBox.getChildren().addAll(leftVBox,centreVBox);





        //俩个小盒子放到主盒子里
        vBox.getChildren().addAll(upVBox,belowHBox);



    }

    /**
     * 初始化返回按钮
     */
    public void initReturnButton(){

        //按钮小盒子
        HBox hBox = new HBox();
        hBox.setSpacing(10);
        hBox.setAlignment(Pos.CENTER);

        Button returnTeachingPlanBtn = new Button("返回教学计划列表");
        returnTeachingPlanBtn.setCursor(Cursor.HAND);
        BtnStyle.cancelBtn(returnTeachingPlanBtn);
        LTeachingPlanViewDetailsReturnTeachingPlanBtnAction teachingPlanViewDetailsReturnTeachingPlanBtnAction = new LTeachingPlanViewDetailsReturnTeachingPlanBtnAction(this);
        returnTeachingPlanBtn.setOnAction(teachingPlanViewDetailsReturnTeachingPlanBtnAction);

        //放入按钮盒子
        hBox.getChildren().add(returnTeachingPlanBtn);

        //放入大盒子
        this.getChildren().add(hBox);

    }


}
